import Vue from 'vue'

export default function(Component, props) {
    const instance = new Vue({
        render(h) {
            return h(Component, { props })
        }
    }).$mount();
    //将生成dom添加到body中
    document.body.appendChild(instance.$el);
    const comp = instance.$children[0];
    comp.remove = () => {
        //销毁实例,并从body中移除dom
        document.body.removeChild(instance.$el);
        instance.$destroy();
    }
    return comp;
}